<?php
//Yii::app()->clientScript->registerScriptFile('https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js');
//Yii::app()->clientScript->registerCssFile('css/jquery-ui-1.8.14.custom.css');
$this->breadcrumbs=array(
	'Portfolios',
);
include "menu.php";
?>
<h1>Portfolios Return</h1>
<div class="form">

<?php
if (isset($_GET['port']))
    $tickerCount = Portfolio::model()->findAll(array('select' => 'companyID', 'distinct' => true, 'condition' => "portfolionameID = " . $_GET['port']));
else
    $tickerCount = "0";
?>
<?php echo CHtml::beginForm('','get'); ?>
	<table><tr><td width="300px">
   
        <label>From</label>
 <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'name'=>'from',
     'value'=>isset($_GET['from']) ? $_GET['from']: "",
                // additional javascript options for the date picker plugin
                'options' => array(
                    'showAnim' => 'fold',
                    'dateFormat' => 'dd/mm/yy',
                    'changeMonth' => true,
                    'changeYear' => true,
                    'yearRange' => '-20:+20',
                    'constrainInput' => true,
                ),
                'htmlOptions' => array(
                    'id' => 'datepickerfrom'
                ),
            )); ?>
  
        <label>To</label>
        <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'name'=>'to',
     'value'=>isset($_GET['to']) ? $_GET['to']: "",
                // additional javascript options for the date picker plugin
                'options' => array(
                    'showAnim' => 'fold',
                    'dateFormat' => 'dd/mm/yy',
                    'changeMonth' => true,
                    'changeYear' => true,
                    'yearRange' => '-20:+20',
                    'constrainInput' => true,
                ),
                'htmlOptions' => array(
                    'id' => 'datepickerto'
                ),
            )); ?>
 
	
	
       <label>Exchange</label>
       <select id="house" name="house" class="house">
                <option value="1">HOSE</option>
                <option value="2">HNX</option>
            </select>
 
	</td><td align="left">
	</td></tr></table>
	
	
 
    <div class="row submit">
        <input type="submit"  value="Submit" />
    </div>
<?php echo CHtml::endForm(); ?>
<?PHP echo $text; 
echo "<br><br>";
?>
<?PHP if(count($data_portfolio)>1)  { ?>
	<script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Date');
        data.addColumn('number', 'Portfolio Index');
        data.addColumn('number', 'Matket Index');
        data.addRows([
		 <?PHP
		 foreach($data_portfolio as $data_now)
		 {
			echo "['".$data_now["date"]."', ".$data_now["pIndex"].", ".$data_now["marketIndex"]."],";
		 }
		 ?>
          
        ]);

        var options = {
          width: 900, height: 480,
          title: 'Portfolio Index'
        };

        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>
	<div id="chart_div"></div>
	<?PHP } ?>
<?PHP //echo $data_portfolio[3]['pIndex']; ?>
</div><!-- form -->
